// 等同于 this.addEventListener / addEventListener
this.addEventListener('message', function(res) {
    var rows = res.data.split('\r\n')
    rows.pop()
    var time = ''
    var times = []
    var oneTime = []
    rows.forEach(item => {
        if (item[4] === '-') { // 时间行
            if (oneTime.length > 0) times.push({ time: time, timeData: oneTime })
            time = item
            oneTime = []
            return
        }
        var rowNumber = item.split(' ')
        var meshIndex = Number(rowNumber[0])
        var sw = Number(rowNumber[1])
        var ss = Number(rowNumber[2])
        var a = Number(rowNumber[3])
        if (meshIndex && sw && ss) {
            oneTime.push([meshIndex, sw, ss, a])
        } else {
            console.log('网格信息错误', rowNumber)
            return
        }
    })
    times.push({ time: time, timeData: oneTime })
    this.postMessage(times)
    this.close()
}, false)
// 监听错误
this.addEventListener('error', function(e) {
    console.error(e)
}, false)
// this.close(); // 终止通信
